import os.path

from store.HouseStore import HouseStore
from store.XiaoquStore import XiaoquStore
from optparse import OptionParser
import sys
import conf

class OperateDBHouse:

    def __init__(self):
        self.house_store = HouseStore()
        self.xiaoqu_store = XiaoquStore()

    def set_house_like(self, house_id):
        self.house_store.set_like(house_id,1)

    def flush_desc(self):
        self.xiaoqu_store.flush_all_sold()

    def flush_bed(self):
        self.house_store.flush_all_bed()

    def set_offline(self,house_id):
        self.house_store.set_status(house_id,1)

    def set_xiaoqu_like(self, xiaoqu_id):
        self.xiaoqu_store.set_like(xiaoqu_id,1)


if __name__ == "__main__":
    project_path = conf.PROJECT_PATH
    if project_path not in sys.path:
        sys.path.append(project_path)
    print(sys.path)
    parser = OptionParser()
    parser.add_option("-t", "--type", dest="type",
                      help="xiaoqu or house")
    parser.add_option("-d", "--did", dest="destId",
                      help="id of xiaoqu or house")
    (options, args) = parser.parse_args()
    print(options)
    # operator = OperateDBHouse()
    # operator.set_house_like("101119113995")
    # operator.set_xiaoqu_like("1111027379998")